package com.example.demo.mapper;

import com.example.demo.dto.OrderDto;
import com.example.demo.dto.OrderItemDto;
import com.example.demo.dto.OrderShoppingDto;
import com.example.demo.entity.Orders;
import com.example.demo.entity.ProductSku;
import com.example.demo.entity.Shopping;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;


@Mapper
public interface OrdersMapper {
//    public List<Orders> selectOrdersById(Integer id);
    List<Orders> selectOrdersByStatus(OrderDto orderDto);

    //搜索所有status=1的订单
    List<Orders> selectAllOrder();

    //将超时的订单修改状态
    void updataOrderStatus(String orderId);


    //添加库存
    void cancelOrder(@Param("skuId")String skuId,@Param("buyCounts") Integer buyCountsbuy);

    /**
     * 添加order表
     * @param orderItemDto
     */
    void addOrder(OrderItemDto orderItemDto);

    /**
     * 添加orderItem表
     * @param orderItemDto
     */
    void addOrderItem(OrderShoppingDto orderItemDto);

    /**
     * 查询生成的订单编号
     * @param orderId
     * @return
     */
    Orders selectOneOrder(String orderId);

    /**
     * 修改库存
     * @param productSku
     */
    void updateStock(ProductSku productSku);

    void cancelOrder(String orderId);

    void cancelOrderUpdateStatus(String orderId);

}
